/*****
author : sailing
date: 2016/11/20
******/
import Config from './config'
import tools from './tools'
import data from './data'
export default {
  selectEl (el) {
    var element = {
      el: el,
      data: el.data()
    }
    el.removeClass('search')
    if (!data.s_select) {
     // data.s_select.el.removeClass('eater')
      data.s_select = element
      data.s_select.el.addClass('eater')
      data.s_select.el.removeClass('search')
    } else {
      if (el.id() === data.s_select.el.id()) return
      if (data.e_select) {
        data.e_select.el.removeClass('eater')
      }
      data.e_select = element
      data.e_select.el.addClass('eater')
      data.e_select.el.removeClass('search')
    }
  },
  clear (cy) {
    if (data.s_select) {
      data.s_select.el.removeClass('eater')
      data.s_select = null
    }
    if (data.e_select) {
      data.e_select.el.removeClass('eater')
      data.e_select = null
    }

    data.cy.nodes(function (i, node) {
      var data = node.data()
      node.removeClass('search')
    })
  }
}
